<?php 
class CategoryModel extends Model{
	public $table = 'category';
	public $validate=array(
		array('catname','nonull','栏目不能为空',2,3)
		);
	public $auto=array(
		array('pid','_pid','method',2,3)
	);
	public function _pid($v){
		return empty($v) || !is_numeric($v)?0:$v;
	}


	//添加栏目
	public function addCategory(){
		if ($this->create()) {
			return $this->add();
		}
	}

	//编辑栏目
	public function editCategory(){
		if ($this->create()) {
			return $this->save();
		}
	}
}


 ?>